package throwable;

/**
 * Created by simod on 2019/12/20
 */
class MyException extends Exception {
    public MyException(String message) {
        super(message);
    }
}

public class ExceptionTest {
    public static void compare(int a, int b) throws MyException {
        if (a < b) {
            throw new MyException("error");
        } else {
            System.out.println("ok");
        }
    }

    public static void main(String[] args) {
        try {
            int a = 3;
            int b = 4;
            compare(a, b);
        } catch (MyException e) {
            System.out.println(e.getMessage());
        }
        System.out.println("success");
    }
}
